﻿using System;
using System.Collections.Generic;
using System.Text;

namespace SourceBackup
{
    [Serializable]
    public class BackupFilter
    {
        public BackupFilter()
        {
            FilterList = new List<string>();
        }
        public BackupFilter(string name, string fileFilters)
        {
            Name = name;
            FilterList = new List<string>();
            foreach (string fileMask in fileFilters.Split(';'))
            {
                if (!FilterList.Contains(fileMask))
                    FilterList.Add(fileMask);
            }
        }

        public string Name { get; set; }
        public List<string> FilterList { get; set; }
        public string Filters()
        {
            StringBuilder output = new StringBuilder();
            foreach (string filterStr in FilterList)
            {
                output.Append(filterStr + ";");
            }
            return output.ToString().TrimEnd(';');
        }

        public override string ToString()
        {
            return Name;
        }
    }
}
